<?php

namespace PackageSpy;

/**
 * Service provides info about package
 * @author P�emysl Cimb�lek
 *
 */
class PackageInfoService
{
	 /**
	 * Goes through providers and returns info about package
	 * @param unknown $id
	 * @return \PackageSpy\ProviderInfoResult
	 */
	private $model;
	private $stateModel;
	
	public function getPackageInfo($id){
    	$provider1 = new CzechPostPackageInfoProvider(); //LATER change to autowired service
    	$result1 = $provider1->searchResult($id);

    	//LATER change to array of providers
		return $result1;
	}
	
	public function __construct(PackageModel $model, PackageStateModel $stateModel)
	{
		$this->model = $model;
		$this->stateModel = $stateModel;
	}
	
	public function findByRefPackage($refPackage)
	{
		//$packageModel = \Nette\Environment::getApplication()->getContext()->getService('PackageSpy\PackageModel');
		$package = $this->model->findPackage($refPackage);
		//$states = $this->stateModel->searchPackageState($refPackage);
		$states = null;
		//return new PackageInfo($package, $states);
		print_r($package);
		return null;
	}
	
}